package GUI;

import Logica.consultaAppClinic;

import java.awt.Dimension;

import java.awt.Rectangle;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.JButton;
import javax.swing.JComboBox;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JList;

public class ConsultaAppClinic extends JFrame {
  private JLabel jLabel1 = new JLabel();
  private JLabel jLabel2 = new JLabel();
  private JLabel jLabel3 = new JLabel();
  private JComboBox jComboBoxFechaIn;
  private JComboBox jComboBoxFin;
  private JComboBox jComboBoxNumClinic;
  consultaAppClinic logica = new consultaAppClinic();
  private JButton jButton1 = new JButton();
  Object[] info = null;

  public ConsultaAppClinic() {
    try {
      jbInit(info);
      Object[] infor = info;
    } catch (Exception e) {
      e.printStackTrace();
    }
  }

  private void jbInit(Object[] info) throws Exception {
    this.getContentPane().setLayout(null);
    this.setSize(new Dimension(606, 481));

    System.out.println("aaaaaaaaa");
    jLabel1.setText("Fecha Inicio");
    jLabel1.setBounds(new Rectangle(30, 55, 80, 35));
    jLabel2.setText("Fecha Fin");
    jLabel2.setBounds(new Rectangle(285, 55, 80, 35));
    jLabel3.setText("Numero Clinica");
    jLabel3.setBounds(new Rectangle(140, 215, 120, 35));

    String[] infoString = new String[100];

    int i = 0;
    while (info[i] != null) {
      infoString[i] = String.valueOf(info[i]);
      i++;
    }
    jComboBoxFechaIn = new JComboBox(infoString);
    jComboBoxFin = new JComboBox(infoString);

    System.out.println("aaaaaaaaa2");
    String[] infoString2 = new String[100];
    Object[] info2 = logica.consultarClinicas();
    System.out.println("aaaaaaaaa2.1");
    i = 0;
    while (info[i] != null) {
      infoString2[i] = String.valueOf(info2[i]);
      i++;
    }
    System.out.println("aaaaaaaaa3");
    jComboBoxNumClinic = new JComboBox(infoString2);
    jComboBoxFechaIn.setBounds(new Rectangle(100, 60, 125, 30));
    jComboBoxFin.setBounds(new Rectangle(385, 60, 140, 30));
    jComboBoxNumClinic.setBounds(new Rectangle(295, 215, 150, 30));
    jButton1.setText("Consulta");
    jButton1.setBounds(new Rectangle(415, 335, 130, 35));
    jButton1.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
          jButton1_actionPerformed(e);
        }
      });
    this.getContentPane().add(jButton1, null);
    this.getContentPane().add(jComboBoxNumClinic, null);
    this.getContentPane().add(jComboBoxFin, null);
    this.getContentPane().add(jComboBoxFechaIn, null);
    this.getContentPane().add(jLabel3, null);
    this.getContentPane().add(jLabel2, null);
    this.getContentPane().add(jLabel1, null);
    this.setVisible(true);
  }

  private void jButton1_actionPerformed(ActionEvent e) {
    MostrarResAppClinic a =
      new MostrarResAppClinic(this.jComboBoxFechaIn.getSelectedItem().toString(),
                              this.jComboBoxFin.getSelectedItem().toString(),
                              this.jComboBoxNumClinic.getSelectedItem().toString());
    a.setVisible(true);
  }
}
